package com.samphanie.auiu.library.log;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author ZSY
 */
public class AuiuLogManager {

    private AuiuLogConfig config;
    private static AuiuLogManager instance;
    private List<AuiuLogPrinter> printers = new ArrayList<>();
    private AuiuLogManager(AuiuLogConfig config, AuiuLogPrinter[] printers) {
        this.config = config;
        this.printers.addAll(Arrays.asList(printers));
    }

    public static AuiuLogManager getInstance() {
        return instance;
    }

    public static void init(@NonNull AuiuLogConfig config, AuiuLogPrinter... printers) {
        instance = new AuiuLogManager(config, printers);
    }

    public AuiuLogConfig getConfig() {
        return config;
    }

    public List<AuiuLogPrinter> getPrinters() {
        return printers;
    }

    public void addPrinter(AuiuLogPrinter printer) {
        printers.add(printer);
    }

    public void removePrinter(AuiuLogPrinter printer) {
        if (printer != null) {
            printers.remove(printer);
        }
    }
}
